Release 10.1A: OpenEdge Development:
Progress 4GL Handbook


Defining a slider

Next you’ll add a slider object to the window. A slider visually represents an INTEGER value within some range. In this case, you’ll just make the slider show the same value as the Average Discount field, but as a percentage between 0 and 50.

To define a slider:

  1. Select the Slider icon from the Palette:
  2. Drop it onto the design window to the right of the Average Discount field.
  3. Change the Object name to iDiscPct. You’ll see that the Label field is not enabled for the slider because a slider cannot have a label.
  4. Go into the property sheet for the slider and change the attribute values, as described in Table 9–1.
  5. Table 9–1: iDiscPct attribute values
    Attribute
    Change value to . . .
    Description
    Max Value
    50
    Shows values in the range from 0 to 50.
    Tic Marks
    Top/Left
    Shows tic marks on the top of the slider.
    Frequency
    5
    Shows tic marks every 5 units.
    Horizontal
    true
    Displays the slider horizontally instead of vertically.
    Enable
    false
    Prevents the user from manipulating the slider object.

    When you are done, the property sheet should look like this:

  6. Click OK after making these changes.
  7. You want the slider value to display along with the other extra fields at the bottom of the window each time the user selects a browse row, so edit the VALUE-CHANGED trigger for the browse and replace the line that assigns the dAvgDisc field and the DISPLAY statement that follows it with these lines:
  8. ASSIGN dAvgDisc =  (dTotalPrice - dTotalExt) / dTotalPrice 
           iDiscPct = dAvgDisc * 100. 
      DISPLAY dTotalPrice dTotalExt dAvgDisc iDiscPct cWorstWH cBestWH 
          WITH FRAME CustQuery. 
    

  9. You can make the slider tall enough to show the percentage value above the slider itself, or shrink it down vertically so that it just shows the slider itself. It should show the same value as the Average Discount field it’s next to:
Looking at the code for a slider

Here is the AppBuilder-generated code for the slider:

DEFINE VARIABLE iDiscPct AS INTEGER INITIAL 0  
     VIEW-AS SLIDER MIN-VALUE 0 MAX-VALUE 50 HORIZONTAL  
     TIC-MARKS TOP FREQUENCY 5 
     SIZE 25 BY 1.19 NO-UNDO. 


Copyright © 2005 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095